package sk.hackcraft.util.generator.empirical;

public abstract class AbstractBuilderItem implements Comparable<AbstractBuilderItem>
{
	public static abstract class EmpiricalItemCreatorDelegate
	{
		public abstract EmpiricalItem createEmpiricalItem(double cumulativeValue);
	}
	
	private final double probability;

	public AbstractBuilderItem(double probability)
	{
		this.probability = probability;
	}
	
	public double getProbability()
	{
		return probability;
	}
	
	public abstract EmpiricalItemCreatorDelegate getEmpiricalItemCreatorDelegate();

	@Override
	public int compareTo(AbstractBuilderItem o)
	{
		if(this.getProbability() > o.getProbability())
		{
			return 1;
		}
		else if(this.getProbability() < o.getProbability())
		{
			return -1;
		}
		else
		{
			return 0;
		}
	}
}
